.. _example-phreeqc-basics-02: 02 - Parametric Mixing ====================== A sensitivity analysis: two waters mixed in every proportion, at a range of temperatures, and what that does to the saturation of calcite and dolomite. :ref:`example-phreeqc-manual-03` runs one mixing calculation. This one turns the mixing fraction into a parameter and sweeps it, which is the step from *a* model to *a study of* a model. Parameterising the input ------------------------ .. raw:: html :file: study_ex2.html The ``MIX`` block's proportion is written as a parameter rather than a number, and so is the temperature. The input stays an ordinary PHREEQC input -- the parameters are substituted before it is run -- so it can still be checked by running it once with its parameters at their own values. A *Parametric Study* then sweeps the two: the mixing factor from 0 to 1, and temperature over a range. Chaining the two sweeps gives the grid, exactly as in the first Core example. The results ----------- .. figure:: SaturationIndices_op_T=10_cp_.svg :alt: Calcite and dolomite saturation index against mixing factor at 10 degrees :align: center Calcite and dolomite saturation index against mixing factor at 10 °C -- one slice through the grid. Both curves dip below the straight line that would join their endpoints. That is mixing corrosion again: the two end-member waters are each at or near saturation, and intermediate mixtures are undersaturated and would dissolve carbonate. Dolomite responds more strongly than calcite, as it generally does, because its saturation index carries the product of two cation activities rather than one. .. figure:: SaturationIndexSurface.svg :alt: Saturation index surfaces of calcite and dolomite over mixing factor and temperature :align: center The whole grid: saturation index over mixing factor *and* temperature, as two surfaces. The slice above is one line across them. Plotly draws no legend for surface traces, so read them by their relief: dolomite spans about twice the range calcite does -- it reaches higher where the water is saturated and falls further where it is not, and the two cross. That is the same two-cation effect the slice shows, seen over the whole plane. A surface is the right form for a sensitivity analysis because it answers the question the analysis is for -- which input matters more. Here the gradient along the mixing axis is much the steeper of the two over this range, so the mixing proportion dominates and temperature is a second- order effect. That conclusion is visible at a glance and would take several slices to establish otherwise. What it shows ------------- That a parameterised input plus a parametric study turns a single calculation into a map, and that the map answers questions about *sensitivity* that no single run can. Source ------ * Parkhurst, D. L. and Appelo, C. A. J. (2013). *Description of input and examples for PHREEQC version 3.* U.S. Geological Survey Techniques and Methods, book 6, chapter A43.